#!/usr/bin/env python
# -*- coding:utf8 -*-
import sys,os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)

from core.service.admin import Admin_view
from core.service.student import Student_view
from core.service.teacher import Teacher_view


class Run(object):
    def __init__(self):
        pass

    def interactive(self):
        menu = u"""
        -----欢迎进入选课系统-----
        \033[32;1m1、学生视图
        2、讲师视图
        3、管理视图
        4、退出
        \033[0m
        """
        menu_dic = {
            "1": Student_view,
            "2": Teacher_view,
            "3": Admin_view,
        }

        exit_flag = False
        while not exit_flag:
            print(menu)
            option_view = input("请选择视图：").strip()
            if int(option_view) == 4:
                exit_flag = True
            elif option_view in menu_dic:
                menu_dic[option_view].login(self)
            else:
                print("\033[31;1m输入错误，重新输入\033[0m")
